[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
strcpy() Copy One String to Another
#include <string.h> Required for declarations only
char *strcpy(string1,string2);
char *string1; Destination string
const char *string2; Source string
strcpy() copies the contents of 'string2' to 'string1'. The
terminating null character ('\0') is also copied.
Returns: A pointer to 'string1'.
Notes: strcpy() expects to operate on null-terminated
strings. No overflow checking is done when strings
are copied or appended.
strcpy() is the same as stpcpy() except that stpcpy
also returns the length of 'string2'.
-------------------------------- Example ---------------------------------
This example copies the string "SUMMARY" into 'str1'.
#include <string.h>
#include <stdio.h>
char str1[25];
main()
{
strcpy(str1,"SUMMARY");
printf("%s",str1);
}
See Also:
strncpy()
stpcpy()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson